<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>

    var preloadImage=function (path) {
        return new Promise(function (resolve, reject) {
            var image=new Image();
            image.onload=resolve;
            image.onerror=reject;
            image.src=path;
        })
    };
    preloadImage('https://static.leke.cn/images/common/header/logo.png').then(function (s) {
        document.body.append(s.target)
    }).catch(function (e) {
        console.log('error')
    })

    /*new Promise(function (resolve,reject) {
        setTimeout(reject(1),100)
    }).then(function (r) {
        console.log(r)
    }).catch(function (r) {
        console.warn(r)
    });*/
</script>
</body>
</html>